package com.zznj.xzjc.adapter.index;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.net.entity.DictionaryBean;
import com.zznj.xzjc.net.entity.ZzjgBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class ZzjgAdapter extends BaseQuickAdapter<ZzjgBean, BaseViewHolder> {

    public ZzjgAdapter(int layoutResId, @Nullable List<ZzjgBean> data) {
        super(layoutResId, data);
    }

    private int selectPosition = -1;
    public void setSelectPosition(int position){
        this.selectPosition = position;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, ZzjgBean item) {
        TextView content = helper.getView(R.id.content);
        content.setText(item.getModelName());
        ImageView selectImage = helper.getView(R.id.selectImage);
        if(helper.getAdapterPosition() == selectPosition){
            selectImage.setVisibility(View.VISIBLE);
        }else{
            selectImage.setVisibility(View.GONE);
        }

    }
}
